package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.CrossDescriptior;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_4
	{
		
		public static const MODELS_COUNT:Number = 1;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var fourShapeModels:Array = new Array();
			
			fourShapeModels.push(getModel0());
			fourShapeModels.push(getModel1());	
			fourShapeModels.push(getModel2());	
			fourShapeModels.push(getModel3());		
			
			return fourShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var four:ShapeModel;
			var name:String = "MB_4_ANGLR";
			var four_prim:Array = new Array();
			var four_ref:Array = new Array();
			var four_rel:Array = new Array();
			
			four_prim.push(PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE0 | PrimitiveType.LINE3, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			four_ref.push(0, 1, 2, PrimitivePresets.RLT_FULL);
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT | LocationDescriptor.ABOVE, 10)));
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_WESTERN)));
			
			four_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT , 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE , 10, ObjectDescriptor.MAX_BOTTOM, ObjectDescriptor.END_SOUTHERN)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_EASTERN, ObjectDescriptor.BODY)));
			
			four_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 5)));
			
			four = new ShapeModel(Character.FOUR, four_prim, four_ref, four_rel, new Array(), name, false);
			
			return four;				
		}
		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var four:ShapeModel;
			var name:String = "MB_4_ANGLR_CROSS";
			var four_prim:Array = new Array();
			var four_ref:Array = new Array();
			var four_rel:Array = new Array();
			
			four_prim.push(PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE0, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			four_ref.push(0, 1, 2, PrimitivePresets.RLT_FULL);
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT | LocationDescriptor.ABOVE, 10)));
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_WESTERN)));
			
			four_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT , 10, ObjectDescriptor.HALF_LEFT)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE , 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_BOTTOM)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CROSS, CrossDescriptior.CROSSING, 7)));
			
			
			
			four = new ShapeModel(Character.FOUR, four_prim, four_ref, four_rel, new Array(), name, false);
			
			return four;				
		}
		
		//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var four:ShapeModel;
			var name:String = "MB_4_ROUND";
			var four_prim:Array = new Array();
			var four_ref:Array = new Array();
			var four_rel:Array = new Array();
			
			four_prim.push(PrimitiveType.CURVE_56 , PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			four_ref.push(0, 1, PrimitivePresets.RLT_FULL);
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT | LocationDescriptor.ABOVE, 10)));
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
			
			four_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_HIGHER_THAN_HALF, 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 10)));
			
			four = new ShapeModel(Character.FOUR, four_prim, four_ref, four_rel, new Array(), name, false);
			
			return four;				
		}
		
		//---------------------------------------------------
		
		private static function getModel3():ShapeModel{
			var four:ShapeModel;
			var name:String = "MB_4_CLOSED";
			var four_prim:Array = new Array();
			var four_ref:Array = new Array();
			var four_rel:Array = new Array();
			
			four_prim.push(PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE0, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			four_ref.push(0, 1, 2, PrimitivePresets.RLT_FULL);
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT | LocationDescriptor.ABOVE, 10)));
			
			four_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.END_WESTERN)));
			
			four_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT , 10)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE , 10, ObjectDescriptor.MAX_BOTTOM, ObjectDescriptor.END_SOUTHERN)));
			
			four_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_EASTERN, ObjectDescriptor.BODY)));
			
			four_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 5)));
			
			four = new ShapeModel(Character.FOUR, four_prim, four_ref, four_rel, new Array(), name, false);
			
			return four;			
		}
		
		//---------------------------------------------------

	}
}